package com.ctshk.rpc.order.tour.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

@Data
@ApiModel(value="系列团订单列表DTO", description="系列团订单列表DTO")
public class SeriesOrderDetailDTO implements Serializable {

    @ApiModelProperty(value = "ID")
    private Long id;

    @ApiModelProperty(value = "订单号")
    private String orderNumber;

    @ApiModelProperty(value = "团期ID")
    private Long scheduleId;

    @ApiModelProperty(value = "总应收")
    private BigDecimal totalReceivables;

    @ApiModelProperty(value = "总实收")
    private BigDecimal totalPaidIn;

    @ApiModelProperty(value = "剩余应收")
    private BigDecimal remainingReceivables;

    @ApiModelProperty(value = "已退款")
    private BigDecimal refundAmount;

    @ApiModelProperty(value = "总团费")
    private BigDecimal totalTourFee;

    @ApiModelProperty(value = "代收费用")
    private BigDecimal collectionFee;

    @ApiModelProperty(value = "调整费用")
    private BigDecimal adjustmentCost;

    @ApiModelProperty(value = "其他金额")
    private BigDecimal otherAmount;

    @ApiModelProperty(value = "联络人中文姓")
    private String contactCnSurname;

    @ApiModelProperty(value = "联络人中文名")
    private String contactCnName;

    @ApiModelProperty(value = "联络人英文姓")
    private String contactEnSurname;

    @ApiModelProperty(value = "联络人英文名")
    private String contactEnName;

    @ApiModelProperty(value = "联络人性别")
    private Integer contactGender;

    @ApiModelProperty(value = "联络电话")
    private String contactTelephones;

    @ApiModelProperty(value = "联系邮箱")
    private String contactEmail;

    @ApiModelProperty(value = "内部备注")
    private String internalRemark;

    @ApiModelProperty(value = "客户类型")
    private Integer customerType;

    @ApiModelProperty(value = "大客户ID")
    private Long bigClientId;

    @ApiModelProperty(value = "大客户名称")
    private String bigClientName;

    @ApiModelProperty(value = "会员ID")
    private Long memberId;

    @ApiModelProperty(value = "会员姓名")
    private String memberName;

    @ApiModelProperty(value = "会员手机号")
    private String memberMobile;

    @ApiModelProperty(value = "会员邮箱")
    private String memberEmail;

    @ApiModelProperty(value = "会员总积分")
    private String memberScore;

    @ApiModelProperty(value = "会员类型（1：星赏会会员，2：普通会员，3：无会员）")
    private Integer memberType;

    @ApiModelProperty(value = "会员等级")
    private String memberLevel;

    @ApiModelProperty(value = "游客人数")
    private List<SeriesOrderDetailTouristPeopleDTO> touristPeopleList;

    @ApiModelProperty(value = "总人数")
    private Integer totalPeople;

    @ApiModelProperty(value = "删除标识")
    private Integer isDeleted;
    
    @ApiModelProperty(value = "所属代理商ID")
    private Long agentId;

    @ApiModelProperty(value = "代理商名称")
    private String agentName;

    @ApiModelProperty(value = "代理人ID")
    private Long agentUserId;

    @ApiModelProperty(value = "代理人名称")
    private String agentUserName;

    public void setTouristPeopleList(String touristPeopleList) {
        this.touristPeopleList = new ArrayList<>();
        try {
            String[] lineArray = touristPeopleList.split("\\}\\)");
            for (String line : lineArray) {
                String[] columnArray = line.split("]\\)");
                SeriesOrderDetailTouristPeopleDTO dto = new SeriesOrderDetailTouristPeopleDTO();
                if (columnArray.length > 0) {
                    dto.setId(columnArray[0]);
                }
                if (columnArray.length > 1) {
                    dto.setTouristTypeName(columnArray[1]);
                }
                if (columnArray.length > 2) {
                    dto.setPeople(Integer.valueOf(columnArray[2]));
                }
                this.touristPeopleList.add(dto);
            }
        } catch (Exception e) {
        }
    }

}
